Bug 330743 - Up/down spinbuttons won't take zeros and exhibit very strange
authorTor Lillqvist <tml@novell.com>
Thu, 3 Apr 2008 12:44:29 +0000 (12:44 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 3 Apr 2008 12:44:29 +0000 (12:44 +0000)
2008-04-03  Tor Lillqvist  <tml@novell.com>

Bug 330743 - Up/down spinbuttons won't take zeros and exhibit
very strange behavior

* gtk/gtkspinbutton.c (gtk_spin_button_insert_text) [Win32]: Add
workaround for a specific kind of screwed up locale setting.

svn path=/trunk/; revision=19972

ChangeLog
gtk/gtkspinbutton.c

index aaccb2c6f310c0880f892fc9595002458bf249b9..740e83ec57a288619e8193aaf4b8cfe007016913 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-04-03  Tor Lillqvist  <tml@novell.com>
+
+       Bug 330743 - Up/down spinbuttons won't take zeros and exhibit very
+       strange behavior
+
+       * gtk/gtkspinbutton.c (gtk_spin_button_insert_text) [Win32]: Add
+       workaround for a specific kind of screwed up locale setting.
+
 2008-04-02  Matthias Clasen  <mclasen@redhat.com>
 
        * gdk/x11/gdkcolor-x11.c: Don't call XFreeColormap on foreign
index 455cb1baa15e88dd699d23170c46280c7560d1cf..8f30b7ad490c69bf9a5bb93dcc33fb15bb413334 100644 (file)
@@ -1453,6 +1453,26 @@ gtk_spin_button_insert_text (GtkEditable *editable,
       else 
        pos_sign = '+';
 
+#ifdef G_OS_WIN32
+      /* Workaround for bug caused by some Windows application messing
+       * up the positive sign of the current locale, more specifically
+       * HKEY_CURRENT_USER\Control Panel\International\sPositiveSign.
+       * See bug #330743 and for instance
+       * http://www.msnewsgroups.net/group/microsoft.public.dotnet.languages.csharp/topic36024.aspx
+       *
+       * I don't know if the positive sign always gets bogusly set to
+       * a digit when the above Registry value is corrupted as
+       * described. (In my test case, it got set to "8", and in the
+       * bug report above it presumably was set ot "0".) Probably it
+       * might get set to almost anything? So how to distinguish a
+       * bogus value from some correct one for some locale? That is
+       * probably hard, but at least we should filter out the
+       * digits...
+       */
+      if (pos_sign >= '0' && pos_sign <= '9')
+       pos_sign = '+';
+#endif
+
       for (sign=0, i=0; i<entry_length; i++)
        if ((entry->text[i] == neg_sign) ||
            (entry->text[i] == pos_sign))